package com.ldk.framework.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ldk.base.framework.dao.IBaseDAO;
import com.ldk.base.framework.service.impl.BaseService;
import com.ldk.framework.service.ICommentService;
import com.ldk.framework.dao.ICommentDAO;
import com.ldk.framework.entity.Comment;

/**
* CommentService接口实现类
* @author xiangwl
*/
@Service
public class CommentService extends BaseService<Comment> implements ICommentService {

	@Autowired
	private ICommentDAO commentDAO;

	@Override
	protected IBaseDAO<Comment> getBaseDao() {
     	return this.commentDAO;
	}

	@Override
	public double calculateStar(String dbKey, String driverOpenId) {
		if(StringUtils.isBlank(driverOpenId))
			return 0;
		try{
			
			return this.commentDAO.calculateStar(dbKey, driverOpenId);
		}
		catch(Exception e){
			logger.error(e.getMessage());
		}
		return 0;
	}

}
